home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10861 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: oxy.rust.net!usenet
  2. From: Neil <neil@aol2.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Major problem with strings.
  5. Date: Sun, 10 Mar 1996 20:31:33 -0500
  6. Organization: Almighty Online
  7. Message-ID: <31438275.72DB@aol2.com>
  8. NNTP-Posting-Host: liv-27.rust.net
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
  13.  
  14. Here's my code:
  15.  
  16. 1    char *club="";
  17. 2    club="/public_html/neil";
  18.  
  19. 3    strcat(club,argv[1]+5);
  20.  
  21. 4    strcat(club,"/");
  22.  
  23. ----------------------------------------
  24. (lines are numbered for reference only)
  25.  
  26. the argv[1] looks like: "test=12345"
  27.  
  28. So, ultimately, I want club to look like: "/public_html/neil12345"
  29.  
  30. I need to add that last "/" (slash) character, and whenever
  31. I do that, KA-BLAMO, it starts adding all of these WEIRD characters.
  32.  
  33. Step 1 just sets up club as a pointer to a char.
  34. Step 2 sets up the initial content to be "/public_html/neil"
  35. Step 3 concats the "12345" part of argv[1] to club
  36. Step 4 SHOULD concat "/" to club..
  37.  
  38. But when Step 4 occurs, it seems to wrap around numbers, and it
  39. gets all messy.  Any reason you can see?
  40.  
  41. Please mailto: neil@aol2.com
  42.  
  43. I've been battling this for HOURS!
  44.  
  45. Thanks,
  46. Neil
  47.